<?php
$this->breadcrumbs = array(
    'Post' => array('index'),
    $model->post_id,
);
?>

<div class="box">
    <header>
        <h5><i class="icon icon-user"></i>View post # <?php echo "{$model->post_id} ({$model->title})" ?></h5>
    </header>
    <div class="body">
	<?php
	$aAttachments = unserialize($model->attachment);
	if (isset($aAttachments['photo']) && $aAttachments['photo']) {
	    $img = "<img src='" . SITE_NAME_URL . "timthumb.php?src=" . UPLOAD_URL_POST . $aAttachments['photo'] . "&w=150&h=150' />";
	} else {
	    $img = "";
	}
	if (isset($aAttachments['youtube']) && $aAttachments['youtube']) {
	    $codeEmbed = getIdEmbed($aAttachments['youtube'], 'youtube');
	    $embed = '<iframe width="691" height="456" src="//www.youtube.com/embed/' . $codeEmbed . '" frameborder="0" allowfullscreen></iframe>';
	} else {
	    if (isset($aAttachments['vimeo']) && $aAttachments['vimeo']) {
		$codeEmbed = getIdEmbed($aAttachments['vimeo'], 'vimeo');
		$embed = '<iframe src="//player.vimeo.com/video/' . $codeEmbed . '" width="691" height="456" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
	    } else {
		$embed = "";
	    }
	}
	?>
	<?php
	if ($parentCat != 3) {
	    $this->widget('bootstrap.widgets.TbDetailView', array(
		'data' => $model,
		'attributes' => array(
		    'post_id',
		    array(
			'name' => 'Composer',
			'value' => $model->user->display_name
		    ),
		    'title',
		    'content',
		    array(
			'name' => 'Category',
			'value' => $model->cat->name
		    ),
		    array(
			'name' => 'Photo',
			'type' => 'raw',
			'value' => $img
		    ),
		    array(
			'name' => 'Share link',
			'type' => 'raw',
			'value' => $embed
		    )
		)
	    ));
	} else {
	    $this->widget('bootstrap.widgets.TbDetailView', array(
		'data' => $model,
		'attributes' => array(
		    'post_id',
		    array(
			'name' => 'Composer',
			'value' => $model->user->display_name
		    ),
		    'title',
		    array(
			'name' => 'Category',
			'value' => $model->cat->name
		    ),
		    'venue_name_event',
		    'street_address_event',
		    'time_start_event',
		    'time_end_event',
		    array(
			'name' => 'Photo',
			'type' => 'raw',
			'value' => $img
		    ),
		    array(
			'name' => 'Share link',
			'type' => 'raw',
			'value' => $embed
		    ),
		    'content',
		    'organizer_name',
		    'organizer_description_event',
		    'web_addr'
		)
	    ));
	}
	?>

    </div>
</div>
